// $ANTLR : "AnasintXML.g" -> "AnasintXML.java"$

package pl.prac06;

import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;

public class AnasintXML extends antlr.LLkParser       implements AnasintXMLTokenTypes
 {

	boolean tag = false;

protected AnasintXML(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
}

public AnasintXML(TokenBuffer tokenBuf) {
  this(tokenBuf,3);
}

protected AnasintXML(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
}

public AnasintXML(TokenStream lexer) {
  this(lexer,3);
}

public AnasintXML(ParserSharedInputState state) {
  super(state,3);
  tokenNames = _tokenNames;
}

	public final void entrada() throws RecognitionException, TokenStreamException {
		
		
		biblioteca();
		match(Token.EOF_TYPE);
	}
	
	public final void biblioteca() throws RecognitionException, TokenStreamException {
		
		
		match(ETIQI);
		match(BIBLIOTECA);
		match(ETIQD);
		{
		_loop4:
		do {
			if ((LA(1)==ETIQI)) {
				libro();
			}
			else {
				break _loop4;
			}
			
		} while (true);
		}
		match(ETIQIC);
		match(BIBLIOTECA);
		match(ETIQD);
	}
	
	public final void libro() throws RecognitionException, TokenStreamException {
		
		
		match(ETIQI);
		match(LIBRO);
		{
		switch ( LA(1)) {
		case ATRIB_ID:
		{
			atributo();
			break;
		}
		case ETIQD:
		{
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(ETIQD);
		{
		if ((LA(1)==ETIQI) && (LA(2)==TITULO)) {
			titulo();
		}
		else if ((LA(1)==ETIQI||LA(1)==ETIQIC) && ((LA(2) >= LIBRO && LA(2) <= EDITORIAL))) {
		}
		else {
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		}
		{
		if ((LA(1)==ETIQI) && (LA(2)==AUTOR)) {
			autor();
		}
		else if ((LA(1)==ETIQI||LA(1)==ETIQIC) && (LA(2)==LIBRO||LA(2)==EDITORIAL)) {
		}
		else {
			throw new NoViableAltException(LT(1), getFilename());
		}
		
		}
		{
		switch ( LA(1)) {
		case ETIQI:
		{
			editorial();
			break;
		}
		case ETIQIC:
		{
			break;
		}
		default:
		{
			throw new NoViableAltException(LT(1), getFilename());
		}
		}
		}
		match(ETIQIC);
		match(LIBRO);
		match(ETIQD);
	}
	
	public final void atributo() throws RecognitionException, TokenStreamException {
		
		
		match(ATRIB_ID);
		match(EQUAL);
		match(ATRIB_VAL);
	}
	
	public final void titulo() throws RecognitionException, TokenStreamException {
		
		
		match(ETIQI);
		match(TITULO);
		match(ETIQD);
		match(TEXTO);
		match(ETIQIC);
		match(TITULO);
		match(ETIQD);
	}
	
	public final void autor() throws RecognitionException, TokenStreamException {
		
		
		match(ETIQI);
		match(AUTOR);
		match(ETIQD);
		match(TEXTO);
		match(ETIQIC);
		match(AUTOR);
		match(ETIQD);
	}
	
	public final void editorial() throws RecognitionException, TokenStreamException {
		
		
		match(ETIQI);
		match(EDITORIAL);
		match(ETIQD);
		match(TEXTO);
		match(ETIQIC);
		match(EDITORIAL);
		match(ETIQD);
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"TEXTO",
		"\"biblioteca\"",
		"\"libro\"",
		"\"autor\"",
		"\"editorial\"",
		"\"titulo\"",
		"LIT_REAL",
		"LIT_ENTERO",
		"NUEVA_LINEA",
		"BLANCO",
		"LETRA",
		"ETIQI",
		"ETIQIC",
		"ETIQD",
		"COMENTARIO",
		"EQUAL",
		"ATRIB_ID",
		"ATRIB_VAL",
		"CADENA"
	};
	
	
	}
